package com.lunkr.demo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class InputURLActivity extends AppCompatActivity {

    EditText mUrlInputET;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_input_url);
        mUrlInputET = (EditText)findViewById(R.id.url_et);
        findViewById(R.id.enter_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String url = mUrlInputET.getText().toString().trim();
                if (TextUtils.isEmpty(url)) {
                    Toast.makeText(InputURLActivity.this, "请输入Coremail URL", Toast.LENGTH_LONG).show();
                    return;
                }
                Intent intent = new Intent(InputURLActivity.this, MainActivity.class);
                intent.putExtra(MainActivity.URL_STRING, url);
                startActivity(intent);
            }
        });
    }
}
